//app.js 调用model.js  model.js有暴露类似于pets,user这样的数据库模板接口
const model = require('./model');

let Pets = model.Pets;
let User = model.User;

(async () => 
{
    var user = await User.create(
    {
        name: 'John',
        gender: false,
        email: 'john-' + Date.now() + '@garfield.pet',
        passwd: 'hahaha'
    });
    console.log('created: ' + JSON.stringify(user));
    var cat = await Pets.create(
    {
        ownerId: user.id,
        name: 'Garfield',
        gender: false,
        birth: '2007-07-07',
    });
    console.log('created: ' + JSON.stringify(cat));
    var dog = await Pets.create(
    {
        ownerId: user.id,
        name: 'Odie',
        gender: false,
        birth: '2008-08-08',
    });
    console.log('created: ' + JSON.stringify(dog));
})();